package com.group.transaction.controller;

import com.alibaba.fastjson.JSONObject;
import com.group.transaction.aspect.InMethod;
import com.group.transaction.domain.Dept;
import com.group.transaction.domain.Role;
import com.group.transaction.service.dept.DeptService;
import com.group.transaction.service.role.RoleService;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("/dept")
@Slf4j
@Data
public class DeptController {
    @Resource
    private DeptService deptService;
    /**
     * 添加部门
     * @param dept
     * @return
     */
    @PostMapping("/addDept")
    @InMethod(apiName = "添加角色")
    public JSONObject addDept (@RequestBody Dept dept) {
        return deptService.addDept(dept);
    }
    /**
     * 编辑部门
     * @param dept
     * @return
     */
    @PostMapping("/compileDept")
    @InMethod(apiName = "编辑部门")
    public JSONObject compileDept (@RequestBody Dept dept) {
        return deptService.compileDept(dept);
    }
    /**
     * 删除部门
     * @param dept
     * @return
     */
    @GetMapping("/deleteDept")
    @InMethod(apiName = "删除部门")
    public JSONObject deleteDept (Dept dept) {
        return deptService.deleteDept(dept);
    }
    /**
     * 查询部门
     * @param dept
     * @return
     */
    @GetMapping("/queryDeptData")
    @InMethod(apiName = "查询部门")
    public JSONObject queryDeptData (Dept dept) {
        return deptService.queryDeptData(dept);
    }
}
